package month09;

public class MainTest {

    public static void main(String[] args){

        Runnable runnable = new Runnable() {
//            TestThread t = new TestThread();
            @Override
            public void run() {
                TestThread t = new TestThread();
                t.show();
            }
        };

        new Thread(runnable).start();
        new Thread(runnable).start();

    }

}

class TestThread{
    int num;

//    public synchronized void show () {
    public void show () {
        for(int i = 0;i<10;i++) {
            System.out.println(Thread.currentThread().getName()+"  "+i);
            num += i;
        }
        System.out.println(Thread.currentThread().getName()+"  "+num);
    }

}
